package JavaSE.StreamLearning.ObjectStream.ObjectOutputStream_Demo;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 *  测试 序列化流
 */
public class Test {
    public static void main(String[] args) throws IOException {
        Person p = new Person(19, "whf");
        ObjectOutputStream oos = new ObjectOutputStream(
                new FileOutputStream("src\\JavaSE.StreamLearning.ObjectStream\\ObjectOutputStream_Demo\\a.txt"));
        oos.writeObject(p);
    }
}

class Person implements Serializable {
    int age;
    String name;
    Person(int age, String name) {
        this.age = age;
        this.name = name;
    }
}
